package cn.bgw;

import org.junit.Assert;
import org.junit.Test;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class Main {

    public static void main(String[] args) {
        String obj = null;
        Assert.assertNotNull(obj, " can not null");

        assertTest();

        threadPoolCoreSizeTest();
    }

    /**
     * 线程池核心线程数为0测试；
     */
    private static void threadPoolCoreSizeTest() {
        // write your code here
        // addWorker(null, false);
        // if (wc >= CAPACITY ||
        //         wc >= (core ? corePoolSize : maximumPoolSize)) core 为false, 取最大线程数做比较
        //
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(0, 10, 1, TimeUnit.SECONDS, new ArrayBlockingQueue<>(10));
        threadPoolExecutor.execute(() -> {
            System.out.println("我被执行了");
        });
    }

    private static void assertTest() {
        int a = 1, b = 2, c = 3;
        a += b - c;

        Assert.assertEquals(0, a);
    }

    @Test
    public void test() {
        System.out.println(" hello world!");
    }


}
